// JavaScript Document
var ajaxvalue = "被拒绝";// 获取当前状态值，该值是通过ajax传递回来的;
var percent = "25%";
var child = 1;
// 获取当前任务的进程
function getAjaxValue(recid,uid) {
	$.ajax({
		type : "POST", // 请求方式
		url : "getNowProgress.scx.szb", // 请求路径
		cache : false,
		data : "szb=" +recid+","+uid, // 传参
		dataType : 'text', // 返回值类型
		success : function(msg) {
			talket(msg);
			datalist(recid);
		}
	});
}
// 获取判断当前状态，调用css状态样式
function talket(ajaxvalue) {
	var zt = ajaxvalue;
	// 处于审核状态
	if (zt == "待审核") {
		percent = "42%";
		child = 2;
		cc(percent, child);
	}
	// 若处于通过
	if (zt == "已通过") {
		percent = "60%";
		child = 3;
		cc(percent, child);
	}
	// 若处于通过
	if (zt == "已完结") {
		percent = "100%";
		child = 4;
		cc(percent, child);
		var stamp = document.getElementById("btnCannel");
		stamp.disabled = true;
		stamp.style.background = "#AAA";
	}
	if (zt == "被拒绝") {
		percent = "60%";
		child = 3;
		cc(percent, child);
		$("#applyCheck").html("拒绝");
	}

}
// 传递状态参数
function cc(p, c) {
	$(".loading").css("width", p);
	for (var i = 1; i <= c; i++) {
		$("#timeLineBox li:nth-child(" + i + ")").css("background", "green");
		$("#timeLineBox li:nth-child(" + i + ")").css("border-left",
				"1px solid green");
		$("#timeLineBox li:nth-child(" + i + ")").css("border-right",
				"1px solid green");
	}
}
// 详细信息
function datalist(Rid) {
	$.ajax({
				type : "POST", // 请求方式
				url : "xxxxDateListServlet.scx.szb", // 请求路径
				cache : false,
				data : "szb=" + Rid, // 传参
				dataType : 'json', // 返回值类型
				success : function(msg) {
					for (i in msg) {
						var information = {
							recruitId : msg[i].recruitId,
							jobName : msg[i].jobName,
							actType : msg[i].actType,
							reSalary : msg[i].reSalary,
							reSex : msg[i].reSex,
							reType : msg[i].reType,
							issueDate:msg[i].issueDate,
							salaryType:msg[i].salaryType
						};
						$("<li><a href='showInformation.jsp?/scx/123szb="
										+ information["recruitId"]
										+ "'>"
										+ "<div class='a_left'>"
										+ "<div class='ico'><img src='../images/menu/"
										+ information["reType"]
										+ "'/></div>"
										+ "</div>"
										+ " <div class='a_right' style='border-bottom:none;'>"
										+ " <h2>"
										+ information["jobName"]
										+ "</h2>"
										+ " <p><em>放心</em><em>"
										+ information["reSex"]
										+ "</em><em>"
										+ information["actType"]
										+ "</em></p>"
										+ "<p class='place'> <em class='a_right local' style='border-bottom: none; background:none; width: 10%; padding-left: 4%; margin-right: 0;'></em> "
										+ "<em style=' background:none;padding-left: 5%; '>"+information["issueDate"]+"</em> <b><strong>"
										+ information["reSalary"]
										+ "</strong>元/"+information["salaryType"]+"</b> </p>" + " </div>"
										+ " </a> </li>").appendTo("#datalist");
					}
				}
			});

}
// 取消报名
function cannelApply(myid,jobid) {
	$.ajax({
		type : "POST", // 请求方式
		url : "cannelUserApplyServlet.scx.szb", // 请求路径
		cache : false,
		data : "szb=" + myid+","+jobid, // 传参
		dataType : 'text', // 返回值类型
		success : function(msg) {
			alert(msg);
		}
	});
}